<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>数字排序</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      background-color: #f4f4f4;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      min-height: 100vh;
      margin: 0;
    }

    input[type="text"] {
      padding: 10px;
      margin: 10px;
      border: 1px solid #ccc;
      border-radius: 4px;
      width: 200px;
    }

    button {
      padding: 10px 20px;
      background-color: #007BFF;
      color: white;
      border: none;
      border-radius: 4px;
      cursor: pointer;
    }

    button:hover {
      background-color: #0056b3;
    }

    #result {
      margin-top: 20px;
      font-weight: bold;
    }
  </style>
</head>

<body>
  <input type="text" id="num1" placeholder="请输入第一个数字">
  <input type="text" id="num2" placeholder="请输入第二个数字">
  <input type="text" id="num3" placeholder="请输入第三个数字">
  <button onclick="sortNumbers()">排序</button>
  <div id="result"></div>

  <script>
    function sortNumbers() {
      // 获取文本框的值
      var num1 = parseFloat(document.getElementById('num1').value);
      var num2 = parseFloat(document.getElementById('num2').value);
      var num3 = parseFloat(document.getElementById('num3').value);

      // 将数字存入数组
      var numbers = [num1, num2, num3];

      // 对数组进行排序（从大到小）
      numbers.sort(function (a, b) {
        return b - a;
      });

      // 显示排序结果
      var resultDiv = document.getElementById('result');
      resultDiv.innerHTML = '从大到小的顺序为：' + numbers.join(', ');
    }
  </script>
</body>

</html>